# coding: utf-8

"""
    NewsCatcher-V3 Production API

    <img src='https://uploads-ssl.webflow.com/6429857b17973b636c2195c5/646c6f1eb774ff2f2997bec5_newscatcher_.svg' width='286' height='35' /> <br>  <br>Visit our website  <a href='https://newscatcherapi.com'>https://newscatcherapi.com</a> <br> <p style=\"color: red\"><b><em> This is a Testing Phase API. Please use it for testing purposes only. </em></b></p> <br>

    The version of the OpenAPI document: Beta-3.0.0
    Contact: maksym@newscatcherapi.com
    Generated by: https://konfigthis.com
"""

import unittest

import os
from pprint import pprint
from newscatcherapi_client import Newscatcher

class TestSearchAll(unittest.TestCase):

    def setUp(self):
        self.client = Newscatcher(host="http://127.0.0.1:4111", api_key="dummy")

    def search(self):
        result = self.client.search.get_all(
            q="q_example",
            search_in="search_in_example",
            published_date_precision="published_date_precision_example",
            sort_by="sort_by_example",
            validate=True
        )
        self.assertIsNotNone(result)
        self.assertEqual(len(result), 6)

        result = self.client.search.post_all(
            q="q_example",
            searchIn="search_in_example",
            publishedDatePrecision="published_date_precision_example",
            sortBy="sort_by_example",
            validate=True
        )
        self.assertIsNotNone(result)
        self.assertEqual(len(result), 6)

    def latest_headlines(self):
        result = self.client.latest_headlines.get_all(
            when="when_example",
            validate=True
        )
        self.assertIsNotNone(result)
        self.assertEqual(len(result), 6)

        result = self.client.latest_headlines.post_all(
            when="when_example",
            validate=True
        )
        self.assertIsNotNone(result)
        self.assertEqual(len(result), 6)

    def authors(self):
        result = self.client.authors.get_all(
            author_name="author_name_example",
            published_date_precision="published_date_precision_example",
            sort_by="sort_by_example",
            ner_name="ner_name_example",
            validate=True
        )
        self.assertIsNotNone(result)
        self.assertEqual(len(result), 6)

        result = self.client.authors.post_all(
            authorName="author_name_example",
            publishedDatePrecision="published_date_precision_example",
            sortBy="sort_by_example",
            nerName="ner_name_example",
            validate=True
        )
        self.assertIsNotNone(result)
        self.assertEqual(len(result), 6)

    def search_similar(self):
        result = self.client.search_similar.get_all(
            q="q_example",
            search_in="search_in_example",
            include_similar_documents=True,
            similar_documents_number=100,
            similar_documents_fields="similar_documents_fields_example",
            published_date_precision="published_date_precision_example",
            sort_by="sort_by_example",
            ner_name="ner_name_example",
            validate=True
        )
        self.assertIsNotNone(result)
        self.assertEqual(len(result), 6)

        result = self.client.search_similar.post_all(
            q="q_example",
            searchIn="search_in_example",
            includeSimilarDocuments=True,
            similarDocumentsNumber=100,
            similarDocumentsFields="similar_documents_fields_example",
            publishedDatePrecision="published_date_precision_example",
            sortBy="sort_by_example",
            nerName="ner_name_example",
            validate=True
        )
        self.assertIsNotNone(result)
        self.assertEqual(len(result), 6)

    def search_link(self):
        result = self.client.search_link.get_all()
        self.assertIsNotNone(result)
        self.assertEqual(len(result), 6)

        result = self.client.search_link.post_all()
        self.assertIsNotNone(result)
        self.assertEqual(len(result), 6)

    def tearDown(self):
        pass


if __name__ == "__main__":
    unittest.main()
